package com.itlong.cloud.equip.operate;

import com.itlong.cloud.POJO.DTO.operate.OperateDeviceAuthFileDTO;
import com.itlong.cloud.POJO.VO.operate.DeviceAuthFileVO;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * <desc>
 *      运营-设备白名单授权文件接口暴露
 * </desc>
 *
 * @createDate2020/8/13
 **/
@FeignClient(name = "equip-service")
public interface IOperateDeviceWhiteListAuthFileServiceClient {

    /**
     * <desc>
     *      分页获取授权文件列表
     * </desc>
     *
     * @param operateDeviceAuthFileDTO  授权文件参数DTO
     * @return 授权文件分页列表
     * @Author Zhu.yj
     * @createDate  2020/8/14
     */
    @PostMapping("/operate/whiteList/authFile/getPage")
    Page<DeviceAuthFileVO> getPage(@RequestBody OperateDeviceAuthFileDTO operateDeviceAuthFileDTO) throws Exception;

    /**
     * <desc>
     *      保存授权文件信息
     * </desc>
     *
     * @param operateDeviceAuthFileDTO 授权文件参数DTO
     * @return 受影响行数
     * @Author Zhu.yj
     * @createDate  2020/8/14
     */
    @PostMapping("/operate/whiteList/authFile/save")
    Integer save(@RequestBody OperateDeviceAuthFileDTO operateDeviceAuthFileDTO) throws Exception;

    /**
     * <desc>
     *      删除授权文件信息
     * </desc>
     *
     * @param operateDeviceAuthFileDTO 授权文件参数DTO
     * @return 受影响行数
     * @Author Zhu.yj
     * @createDate  2020/8/14
     */
    @PostMapping("/operate/whiteList/authFile/delete")
    Integer delete(@RequestBody OperateDeviceAuthFileDTO operateDeviceAuthFileDTO) throws Exception;

    /**
     * <desc>
     * 获取授权文件信息
     * </desc>
     *
     * @param operateDeviceAuthFileDTO
     * @Author chengshican
     * @Date 2020-08-15 10:44
     * @Param arams 查询参数map
     * @Return 授权文件信息
     * @Exception
     */
    @RequestMapping(value = "/operate/whiteList/authFile/getEffectiveAuthFile",method = RequestMethod.POST)
    DeviceAuthFileVO getEffectiveAuthFile(@RequestBody OperateDeviceAuthFileDTO operateDeviceAuthFileDTO) throws Exception ;


    /**
    *<desc>
    * 根据授权文件id更新可用次数和已使用次数
    *</desc>
    *
    * @Author  chengshican
    * @Date   2020-08-16 9:20
    * @Param  operateDeviceAuthFileDTO 授权文件参数DTO
    * @Return      
    * @Exception   
    * 
    */
    @RequestMapping(value = "/operate/whiteList/authFile/updateAuthFileByAuthId",method = RequestMethod.POST)
    int updateAuthFileByAuthId(@RequestBody OperateDeviceAuthFileDTO operateDeviceAuthFileDTO) throws Exception ;

    /**
     * <desc>
     *   获取次数凭证地址
     * </desc>
     *
     * @param authId 授权文件id
     * @return 包含key为 fileName, fileUrl的map的集合
     * @Author Zhu.yj
     * @createDate  2020/8/16
     */
    @PostMapping("/operate/whiteList/authFile/getTimesEvidence")
    List<Map<String, Object>> getTimesEvidence(@RequestParam("authId") String authId) throws Exception;

    /**
     * <desc>
     *      根据文件名称获取文件数量
     * </desc>
     *
     * @param fileName 文件名称
     * @return 文件名为fileName的数量
     * @Author Zhu.yj
     * @createDate  2020/8/17
     */
    @PostMapping("/operate/whiteList/authFile/getCountByFileName")
    Integer getCountByFileName(@RequestParam("fileName") String fileName) throws Exception;
}
